<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入react核心库 -->
	<script type="text/javascript" src="../../js/react.development.js"></script>
	<!-- 引入react-dom，用于支持react操作DOM -->
	<script type="text/javascript" src="../../js/react-dom.development.js"></script>
	<!-- 引入babel，用于将jsx转为js -->
	<script type="text/javascript" src="../../js/babel.min.js"></script>
</head>

<body>
    <div id="root"></div>
    <!-- 注意：js的类型type="text/babel" -->
    <script type="text/babel">
        class Mailbox extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return(
                    <div>
                        {this.props.unreadMessage.length> 0&& <h2>
                            You have  {this.props.unreadMessage.length} unread message.
                            </h2>}    
                    </div>
                )
            }
        }
        const message=['react','react-dom','webpack','webpack-cli','webpack-dev-server'];
        ReactDOM.render(
            <Mailbox unreadMessage={message}/>
            ,document.getElementById('root')
        )
    </script>
</body>

</html>